﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Domain.Model.Repositories;
using Domain.Model.Comparendos;
using Domain.Model.Base;

namespace Infrastructure.Base.InMemory
{

    public class MComparendoRepository : ComparendoRepository
    {
        private Dictionary<ComparendoId, Comparendo> lista;

        public MComparendoRepository()
        {
            this.lista = new Dictionary<ComparendoId, Comparendo>();

        }


        public override void Insert(Comparendo entity)
        {
            this.lista.Add((ComparendoId)entity.Identity, entity);
        }

        public override Comparendo FromId(ObjectIdentity id)
        {
            return this.lista[(ComparendoId)id];
        }

        public override ObjectIdentity NextIdentity()
        {
            return new ComparendoId(Guid.NewGuid().ToString().ToUpper());
        }

        public override void Update(Comparendo entity)
        {
            throw new NotImplementedException();
        }

        public override void Remove(ObjectIdentity id)
        {
            this.lista.Remove((ComparendoId)id);
        }

        public override List<Comparendo> All()
        {
            return new List<Comparendo>(this.lista.Values);
        }

        public override int Count()
        {
            return this.lista.Values.Count;
        }

        public override List<Comparendo> FromIdInfractor(Domain.Model.Infractores.InfractorId idInfractor)
        {
            throw new NotImplementedException();
        }
    }
}
